package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.domain.BaseDomain;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.List;

/**
 * 景点信息
 */
@Getter
@Setter
public class ScenicReviews extends BaseDomain{
    private String name;
    private String enName;  //英文名
    private Destination dest;    //景点目的地
    private Integer commentNum; //评论数量
    private ScenicReviews parent; //父景点
    private String coverUrl;    //封面
    private String[] coverUrls;
    private Integer state;  //是否热门
    private String tel; //电话
    @DateTimeFormat(pattern = "yyyy-MM-dd:HH:mm")
    private String travelTime;  //游玩时间
    private String url; //网址
    private String info;    //景点信息
    private Integer type;   //景点类型
    private Integer deep;   //深度
    private String location;    //景点详细地址
    private String ticketInfo;  //门票信息
    private String subinfo; //景点子信息
    private String content; //交通内容
    private List<ScenicReviews> children = new ArrayList<>();  //内部景点集合

    /**
     *必游景点TOP5 的3张图
     * 数据库存3张图
     * 页面 调getUrl1 来获取一张图
     */
    public String getUrl1() {
        String s = null;
        if (coverUrl != null) {
            String[] split = coverUrl.split(",");
            s = split[0];
        }
        return s;
    }

    public String getUrl2() {
        String[] split = coverUrl.split(",");
        String s = split[1];
        return s;
    }

    public String getUrl3() {
        String[] split = coverUrl.split(",");
        String s = split[2];
        return s;
    }
}
